package com.d3works.apps.account.service.payment;

import com.d3works.apps.account.db.Account;
import com.d3works.apps.account.db.AccountManagement;
import com.d3works.apps.account.db.Journal;
import com.d3works.apps.account.db.Move;
import com.d3works.apps.account.db.PaymentMode;
import com.d3works.apps.base.db.BankDetails;
import com.d3works.apps.base.db.Company;
import com.d3works.apps.base.db.Sequence;
import com.d3works.exception.D3worksException;
import java.util.List;

public interface PaymentModeService {

  public Account getPaymentModeAccount(
      PaymentMode paymentMode, Company company, BankDetails bankDetails) throws D3worksException;

  public Account getPaymentModeAccount(
      PaymentMode paymentMode, Company company, BankDetails bankDetails, boolean global)
      throws D3worksException;

  /**
   * Find payment mode account from the move payment mode, journal and company. Use company active
   * bank details to find the correct account.
   *
   * @param move a move with a filled payment mode, journal and company.
   * @return the found account
   * @throws D3worksException
   */
  public Account getPaymentModeAccount(Move move) throws D3worksException;

  public AccountManagement getAccountManagement(
      PaymentMode paymentMode, Company company, BankDetails bankDetails);

  public Sequence getPaymentModeSequence(
      PaymentMode paymentMode, Company company, BankDetails bankDetails) throws D3worksException;

  public Journal getPaymentModeJournal(
      PaymentMode paymentMode, Company company, BankDetails bankDetails) throws D3worksException;

  public Journal getPaymentModeJournal(
      PaymentMode paymentMode, Company company, BankDetails bankDetails, boolean global)
      throws D3worksException;

  /**
   * @param paymentMode
   * @param company
   * @return list of bankdetails in the payment mode for the given company.
   */
  public List<BankDetails> getCompatibleBankDetailsList(PaymentMode paymentMode, Company company);

  /**
   * Returns a payment mode with the same type as the given payment mode, but with reversed in or
   * out status. Return null if no payment mode were found or if the given payment mode is null.
   */
  public PaymentMode reverseInOut(PaymentMode paymentMode);

  boolean isPendingPayment(PaymentMode paymentMode);
}
